// pages/play/map.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    longitude_begin: 0,
    latitude_begin: 0,
    markers: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this
    that.setData({
      markers: [
        {
          id: 0,
          iconPath: "https://resource.160nurse.com/canvas/healthy/img/play/begin.png",
          latitude: options.lati,
          longitude: options.long,
          width: 32,
          height: 38  
        },
        {
          id: 0,
          iconPath: "https://resource.160nurse.com/canvas/healthy/img/play/end.png",
          latitude: options.lati2,
          longitude: options.long2,
          width: 32,
          height: 38
        }
      ]
    })
    that.getLocationData()
  },
  getLocationData: function () {
    let that = this
    wx.getLocation({
      type: 'gcj02',
      success: function (res) {
        that.setData({
          longitude: res.longitude,
          latitude: res.latitude,
          // speed: 
        })
        // that.setData({
        //   markers: []
        // })
      },
    })
  },
  get_geo: function () {
    let that = this
    that.getLocationData()
  },
  closePage: function () {
    var that = this
    wx.navigateBack({
      url: './run',
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})